<template>
  <div id="app">
    <router-view/>
  </div>
</template>

<script>
import store from "@/store";

export default {
  name: 'App',
  watch: {
    $route(to,from) {
      // console.log(to.path)
      if (to.path !== '/login') {
        //将个人中心的标签添加
        if (to.path === '/userCenter') {
          let obj = {
            name: 'UserCenter',
            title: '个人中心'
          }
          this.$store.commit("addTab",obj)
        }else {
          let obj = {
            name: to.name,
            title: to.meta.title
          }
          this.$store.commit("addTab",obj)
        }
      }
    }
  }
}
</script>
<style>
html,body {
  height: 100%;
  padding: 0;
  margin: 0
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  height: 100%;
  padding: 0;
  margin: 0;
  font-size: 15px;
}
</style>
